#ifndef API_CONFIGURATION_H
#define API_CONFIGURATION_H

#include "lpc_types.h"
#include <stdio.h>

#define CFG_IP_UINT32_TO_CSTR(STR, IP)		sprintf(STR, "%d.%d.%d.%d", (uint8_t)(IP>>24), (uint8_t)(IP>>16), (uint8_t)(IP>>8), (uint8_t)(IP)) 
uint32_t cfg_ip_cstr_to_uint32(uint8_t *str);

uint8_t cfg_write_to_flash(void);
uint8_t cfg_read_from_flash(void);
void cfg_data_union_init(void);

void cfg_get_wln_ip (uint32_t *);
void cfg_set_wln_ip(uint32_t);

void cfg_get_wln_port (uint16_t *);
void cfg_set_wln_port(uint16_t);

void cfg_get_ain_filter_len (uint16_t *, uint8_t);
void cfg_set_ain_filter_len(uint16_t, uint8_t);

void cfg_get_ain_range (uint16_t *, uint8_t);
void cfg_set_ain_range(uint16_t, uint8_t);

void cfg_get_filter_type (uint8_t *, uint8_t);
void cfg_set_filter_type(uint8_t, uint8_t);

void cfg_get_eint_filter_len (uint16_t *, uint8_t);
void cfg_set_eint_filter_len(uint16_t, uint8_t);

void cfg_get_eint_range (uint16_t *, uint8_t);
void cfg_set_eint_range(uint16_t, uint8_t);

void cfg_get_pin (uint32_t *);
void cfg_set_pin(uint32_t);

void cfg_set_apn(uint8_t *);
uint8_t cfg_get_apn(uint8_t *, uint8_t);

void cfg_set_apnlgn(uint8_t *);
uint8_t cfg_get_apnlgn(uint8_t *, uint8_t);

void cfg_set_apnpwd(uint8_t *);
uint8_t cfg_get_apnpwd(uint8_t *, uint8_t);

void cfg_set_wln_pwd(uint8_t *);
uint8_t cfg_get_wln_pwd(uint8_t *, uint8_t);


#endif //APP_CONFIGURATION_H
